package forum.entities;

import java.math.BigInteger;

public class Post extends Entity {

    private String postContains;
    private BigInteger authorId;
    private BigInteger topicId;

    public Post(BigInteger id) {
        super(id);
    }

    public Post(BigInteger id, String postContains,  BigInteger authorId, BigInteger topicId) {
        super(id);
        this.postContains = postContains;
        this.authorId = authorId;
        this.topicId = topicId;
    }

    public String getPostContains() {
        return postContains;
    }

    public void setPostContains(String postContains) {
        this.postContains = postContains;
    }

    public BigInteger getTopicId() {
        return topicId;
    }

    public void setTopicId(BigInteger topicId) {
        this.topicId = topicId;
    }

    public BigInteger getAuthorId() {
        return authorId;
    }

    public void setAuthorId(BigInteger authorId) {
        this.authorId = authorId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (! (o instanceof Post)) return false;
        if (! super.equals(o)) return false;

        Post post = (Post) o;

        if (authorId != null ? ! authorId.equals(post.authorId) : post.authorId != null) return false;
        if (postContains != null ? ! postContains.equals(post.postContains) : post.postContains != null) return false;
        if (topicId != null ? ! topicId.equals(post.topicId) : post.topicId != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (postContains != null ? postContains.hashCode() : 0);
        result = 31 * result + (topicId != null ? topicId.hashCode() : 0);
        result = 31 * result + (authorId != null ? authorId.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        return "Post{" +
                "postContains='" + postContains + '\'' +
                ", authorId=" + authorId +
                ", topicId=" + topicId +
                "} " + super.toString();
    }
}



